<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:th="http://www.thymeleaf.org"
      xmlns:jc="http://www.joinsunsoft.com">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge, chrome=1">
    <script src="/static/common/js/ui.js"></script>
</head>

<body>
<div id="loading" class="loading-wrap">
    <div class="loading-content">
        <div class="loading-round"></div>
        <div class="loading-dot"></div>
    </div>
</div>
<script id="tmpl1" type="text/x-jquery-tmpl">
<div id='layout'data-toggle="cubeui-layout" data-options="fit:true">
    <div data-options="region:'center',title:'授权角色',split:false,collapsible:false,border:false,width:500,iconCls:'fa fa-user-circle-o',
    headerCls:'border_right',bodyCls:'border_right'">
    <table id="roleDg"></table>
    <!-- 表格工具栏开始 -->
    <div id="roleDg-toolbar" class="cubeui-toolbar"
         data-options="grid:{
               type:'datagrid',
               id:'roleDg'
           }">

<!--        <a  href="javascript:void(0)" data-toggle='cubeui-menubutton' data-options="{-->
<!--                method1: 'openDialog',-->
<!--                onClick:function(){-->
<!--                    grantPermission();-->
<!--                },-->
<!--                extend: '#roleDg-toolbar',-->
<!--                btnCls: 'cubeui-btn-blue',-->
<!--                iconCls: 'fa fa-plus'-->
<!--            }">新增权限</a>-->

        <a  href="javascript:void(0)" data-toggle='cubeui-menubutton' data-options="{
                onClick:function(){
                    grantAll();
                },
                extend: '#roleDg-toolbar',
                btnCls: 'cubeui-btn-blue',
                iconCls: 'fa fa-universal-access'
            }">全部授予</a>

        <a  href="javascript:void(0)" data-toggle='cubeui-menubutton' data-options="{
                onClick:function(){
                    emptyRole();
                },
                extend: '#roleDg-toolbar',
                btnCls: 'cubeui-btn-red',
                iconCls: 'fa fa-trash'
            }">全部撤销</a>

        <a  href="javascript:void(0)" data-toggle='cubeui-menubutton' data-options="{
                onClick:function(){
                    $('#roleDg').datagrid('reload')
                },
                extend: '#roleDg-toolbar',
                btnCls: 'cubeui-btn-orange',
                iconCls: 'fa fa-refresh'
            }">刷新</a>
    </div>
    </div>
</div>

<template id='eastTpl'>
    <table id="permissionDg"></table>
</template>


<template id='footerTpl'>
	<div id='footer' style="padding: 5px; text-align: right;">
        <a  href="javascript:void(0)" data-toggle='cubeui-menubutton' data-options="{
                onClick:function(){
						closePermPanel();
                },
                btnCls: 'cubeui-btn-red',
                iconCls: 'fa fa-close'
            }">关闭</a>
	</div>
</template>
</script>

</body>
<script>
    new APP(function () {
        return {
            css: [],
            js: [
                ROOT_RES_URL + "/api/api.js",
                ROOT_RES_URL + "/api/model.js",
                ROOT_RES_URL + "/api/menu.js",
                ROOT_RES_URL + "/auth/user.js",
            ],
            render: function () {
                stop = true
                console.log("finish")

                let data = $.extend({}, $.v3browser.menu.getCurrentTabAttachData());

                APP.renderBody("#tmpl1", data)

                // let t = $.templates("#tmpl1").render({id:"1022", name:"davidliu"})
                // $('body div').remove()
                // $(t).appendTo($('body'))
            }
        }
    });


    APP.fn(function(){
        load();
    })
</script>
</html>